﻿Imports QLTHUVIEN.DTO
Public Class LoaiDocGiaDAO
    Public Function LayDanhSach() As DataTable
        Dim strSql As String = "SELECT MaLoaiDocGia, TenLoaiDocGia FROM LOAIDOCGIA WHERE isDelete = 'False'"
        Dim dt As DataTable = DataProvider.ExecuteQuery(strSql)
        Return dt
    End Function

    Public Sub ThemLoaiDocGia(ByVal LoaiDocGia As LoaiDocGiaDTO)
        Dim strSql As String = "INSERT INTO LOAIDOCGIA(TenLoaiDocGia) VALUES(N'" & LoaiDocGia.TenLoaiDocGia & "')"
        DataProvider.ExecuteQuery(strSql)
    End Sub

    Public Sub SuaLoaiDocGia(ByVal LoaiDocGia As LoaiDocGiaDTO)
        Dim strSql As String = "UPDATE LOAIDOCGIA SET TenLoaiDocGia =N'" & LoaiDocGia.TenLoaiDocGia & "' WHERE MaLoaiDocGia = " & LoaiDocGia.MaLoaiDocGia
        DataProvider.ExecuteQuery(strSql)
    End Sub

    Public Sub XoaLoaiDocGia(ByVal LoaiDocGia As LoaiDocGiaDTO)
        Dim strSql As String = "UPDATE LOAIDOCGIA SET isDelete ='" & LoaiDocGia.IsDelete.ToString() & "' WHERE MaLoaiDocGia = " & LoaiDocGia.MaLoaiDocGia
        DataProvider.ExecuteQuery(strSql)
    End Sub
End Class
